#ifndef _TIMER_H_
#define _TIMER_H_

#include <Ticker.h>

Ticker timer_seconds;
Ticker timer_ms;

void ICACHE_RAM_ATTR timerhandlems()
{
    bright++;
    if (bright >= max_bright)
        timer_ms.detach();
    FastLED.setBrightness(bright); // need not to show
}

void ICACHE_RAM_ATTR timerhandleseconds()
{
    uint8_t code = static_cast<int>(mode);
    switch (control_type)
    {
    case CIRCULATION:
        code = (code + 1) % 9;
        break;
    case RANDOM:
        code = random(100) % 9;
        break;
    }

    mode = static_cast<Mode>(code);
    isMODEModified = true; // Change Flag
    Serial.printf("\nChange to %d\n", code);
}

#endif